home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 1.0 KB | 48 lines | [TEXT/ttxt] |
- in module HolidayModule
-
- class Animation (TwoDShape)
- instance variables
- animationClock
- series
- cell
- end
-
- method start self {class Animation} ->
- (
- self.animationClock.rate := 1
- )
-
- method stop self {class Animation} ->
- (
- self.animationClock.rate := 0
- )
-
- -- Called at each tick of the animation clock.
- -- Change current cell to the next cell in the series.
- method tick self {class Animation} clk ->
- (
- -- Change to the appropriate cell
- self.boundary := self.series[self.cell]
-
- -- Get the next cell. Wrap around if at the end.
- self.cell := ((mod self.cell self.series.size) as Integer) + 1
- )
-
- method init self {class Animation} #rest args \
- #key series:(#(new Oval x2:100 y2:100)) \
- scale:(5) ->
- (
- apply nextMethod self boundary:(series[1]) fill:defaultBrush args
-
- self.series := series
- self.cell := 1
-
- local animationClock := (new Clock scale:scale)
- addPeriodicCallBack animationClock (clk -> tick self clk) animationClock #() 1
- animationClock.rate := 0
- self.animationClock := animationClock
- self
- )
-
-
-